package com.example.personnel_oa.service.impl;



import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.comment_oa.pojos.Offer;
import com.example.personnel_oa.mapper.OfferMapper;
import com.example.personnel_oa.mapper.RecruitsMapper;
import com.example.personnel_oa.service.OfferService;
import com.example.personnel_oa.service.RecruitsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author HEYONG
* @description 针对表【offer】的数据库操作Service实现
* @createDate 2022-12-20 21:15:20
*/
@Service
public class OfferServiceImpl extends ServiceImpl<OfferMapper, Offer>
implements OfferService {
    @Autowired
    OfferMapper offerMapper;
    @Autowired
    RecruitsMapper recruitsMapper;

    //查询是否有offer数据
    @Override
    public Offer chaOffer(int talentsId) {
        Offer offer = offerMapper.chaOffer(talentsId);
        return offer;
    }

    //新增offer数据
    @Override
    public int addOffer(Offer offer) {
        Offer offer1 = offerMapper.chaOffer(offer.getTalentsId());
        if (offer1 == null){
            int i = offerMapper.addOffer(offer);
            return i;
        }
        return 0;
    }

    //发送offer
    @Override
    public int upOffer(Offer offer) {
        int i = offerMapper.upOffer(offer);
        return i;
    }
}
